import 'package:flutter/material.dart';
import 'package:flutterLearningExperience/widget/animated/animated.dart';
import 'package:flutterLearningExperience/widget/animated/counter.dart';

import 'package:flutterLearningExperience/widget/demo/demo.dart';
import 'package:flutterLearningExperience/widget/ball/runball-widget.dart';
import 'package:flutterLearningExperience/widget/flare/flare.dart';
import 'package:flutterLearningExperience/widget/paint/paint.dart';
import 'package:flutterLearningExperience/widget/transition/animate-build.dart';
import 'package:flutterLearningExperience/widget/transition/interval.dart';
import 'package:flutterLearningExperience/widget/transition/transition.dart';

class MyRouter {
  Widget widget;
  String path;
  String name;

  MyRouter({@required this.widget, @required this.path, @required this.name});
}

List<MyRouter> routers = [
  MyRouter(name: '官方demo', path: '/demo', widget: DemoPage()),
  MyRouter(name: '球demo', path: '/ball', widget: RunBall()),
  MyRouter(name: '隐式动画', path: '/animated', widget: AnimatedDemo()),
  MyRouter(name: '计数器', path: '/counter', widget: CounterDemo()),
  MyRouter(name: '显式动画', path: '/transition', widget: TransitionDemo()),
  MyRouter(name: '交错动画', path: '/interval', widget: IntervalTransition()),
  MyRouter(name: '自定义', path: '/animatedBuilder', widget: AnimatedBuildDemo()),
  MyRouter(name: '画笔', path: '/paint', widget: PaintModel()),
  MyRouter(name: 'flare', path: '/flare', widget: FlareDemo()),
];

Map<String, WidgetBuilder> appRouter() {
  Map<String, WidgetBuilder> route = Map();

  routers.forEach((element) {
    route[element.path] = (context) => element.widget;
  });

  return route;
}
